Sponsored Content
Top Forums Shell Programming and Scripting Python concat list with a string variable Post 302992735 by apmcd47 on Wednesday 1st of March 2017 06:40:57 AM
Old 03-01-2017
You are using join wrong in the above example. Join needs a list or tuple of strings:
Code:
>>> '-'.join(('north','east','south','west'))
'north-east-south-west'

Alternatively use the add (+) operator:
Code:
>>> 'Grace' + 'Kelly'
'GraceKelly'

Andrew
This User Gave Thanks to apmcd47 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

concat string

hey, I want to concat whole bunch of strings together but somehow they don't turn out the way I want them to a="HELLO " b="WORLD " c=$a$b I was expecting c to be "HELLO WORLD " but it... (1 Reply)
Discussion started by: mpang_
1 Replies

2. Programming

simple question on string concat

This is a simple question... char *str = NULL; int num = 0; scanf ("%d", &num); str = ??? I want str to point to the string num.txt For e.g: If user enters num = 5, str should point to "5.txt" How do I do that ? Thanks (2 Replies)
Discussion started by: the_learner
2 Replies

3. UNIX for Dummies Questions & Answers

String concat that keeps quotes

Hi All, I hope you can help. i am concatenating String variables using the following method. command="$command$x" i have created a script which takes a set of args passed to the script using the $* #example script args=$* count=0 for x in $args do count=`expr $count + 1` ... (8 Replies)
Discussion started by: duke
8 Replies

4. Shell Programming and Scripting

[python]string to list conversion

I have a file command.txt. It's content are as follows:- The content of file is actually a command with script name and respective arguments. arg1 and arg2 are dummy arguments , format : -arg arg_value test is a argument specifying run mode , format : -arg In my python code, i read it and... (1 Reply)
Discussion started by: animesharma
1 Replies

5. Shell Programming and Scripting

Remove lines between the start string and end string including start and end string Python

Hi, I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Discussion started by: Dabheeruz
1 Replies

6. Shell Programming and Scripting

Python get the expect value from a variable

the value of the variable is yes group=bsp_16 keyword="82599" test_var="-a xxx -b yyy" I want to get output with -a xxx -b yyy (0 Replies)
Discussion started by: yanglei_fage
0 Replies

7. Shell Programming and Scripting

Variable Substitution in Python

Hi, Please I have the following python code. x = time.strftime("%Y_%m_%d") os.system("/gsn/mme/parse_ebm_log.pl -x /gsn/mme/ -u -r gsm -f /gsn/mme/mme01/ebs/A* >> /gsn/mme/mme01/+ str(x)_gsm.txt") os.system("/gsn/mme/parse_ebm_log.pl -x /gsn/mme/ -u -r wcdma -f /gsn/mme/mme01/ebs/A* >>... (2 Replies)
Discussion started by: infinitydon
2 Replies

8. Shell Programming and Scripting

Concat String with variable after a 'grep' and awk

Here is the structure of my file: MyFile.txt g-4.n.g.fr 10.147.243.63 g-4.n.g.fr-w1 Here is my sript: test.sh #! /bin/sh ip=10.147.243.63 worker=$(grep -e $ip $1 | awk '{ print $3; }') echo "" echo $worker echo "" echo $worker echo "" echo "$worker.v.1" echo... (7 Replies)
Discussion started by: chercheur111
7 Replies

9. UNIX for Beginners Questions & Answers

Check if string variable is a subset of another string variable

Below is my ksh shell script where I need to check if variable fileprops is a subset of $1 argument. echo "FILE PROPERTY: $fileprops" echo "PARAMETER3: $1" if ; then echo "We are Good. $line FILE is found to be INTACT !! " else echo... (2 Replies)
Discussion started by: mohtashims
2 Replies

10. Programming

Python variable at different position

I have a file which records banking transactions say like below. user1 has deposited 10,000$ in his account user2 has deposited 11,000$ in his account user1 has withdraw today 5000$ from his account. Lets say i read this file and convert each line as a list. username= word action=... (1 Reply)
Discussion started by: sahil_shine
1 Replies
Gtk2::Container(3pm)					User Contributed Perl Documentation				      Gtk2::Container(3pm)

NAME
Gtk2::Container - wrapper for GtkContainer HIERARCHY
Glib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::Widget +----Gtk2::Container INTERFACES
Glib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable METHODS
$container->add ($widget) o $widget (Gtk2::Widget) $container->add_with_properties ($widget, ...) o $widget (Gtk2::Widget) o ... (list) list of property name/value pairs integer = $container->get_border_width $container->set_border_width ($border_width) o $border_width (integer) $container->check_resize list = $container->child_get ($child, ...) o $child (Gtk2::Widget) o ... (list) list of property names Returns a list of properties of the child. list = $container->child_get_property ($child, ...) o $child (Gtk2::Widget) o ... (list) Alias for child_get $container->child_set ($child, ...) o $child (Gtk2::Widget) o ... (list) list of property name/value pairs Sets a list of properties on the child. $container->child_set_property ($child, ...) o $child (Gtk2::Widget) o ... (list) Alias for child_set string = $container->child_type list = $container->get_children Returns a list of Gtk2::Widget's, the children of the container. pspec or undef = $object_or_class_name->find_child_property ($name) o $name (string) Return a "Glib::ParamSpec" for child property $name on container $object_or_class_name. If there's no property $name then return "undef". See Glib::Object "list_properties" for the fields in a ParamSpec. list = $container->get_focus_chain Returns a list of Gtk2::Widgets, the focus chain. $container->set_focus_chain (...) o ... (list) of Gtk2::Widget's, the focus chain Sets a focus chain, overriding the one computed automatically by GTK+. In principle each widget in the chain should be a descendant of the container, but this is not enforced by this method, since it's allowed to set the focus chain before you pack the widgets, or have a widget in the chain that isn't always packed. The necessary checks are done when the focus chain is actually traversed. widget or undef = $container->get_focus_child Since: gtk+ 2.14 $container->set_focus_child ($child) o $child (Gtk2::Widget or undef) adjustment or undef = $container->get_focus_hadjustment $container->set_focus_hadjustment ($adjustment) o $adjustment (Gtk2::Adjustment or undef) adjustment or undef = $container->get_focus_vadjustment $container->set_focus_vadjustment ($adjustment) o $adjustment (Gtk2::Adjustment or undef) $container->forall ($callback, $callback_data=undef) o $callback (subroutine) Code to invoke on each child widget o $callback_data (scalar) Invoke $callback on each child of $container, including "internal" children. Most applications should not use this function. Compare with Gtk2::Container::foreach. $container->foreach ($callback, $callback_data=undef) o $callback (subroutine) Code to invoke on each child widget o $callback_data (scalar) Invoke $callback on each child of $container, ignoring "internal" children. list = $object_or_class_name->list_child_properties Return a list of "Glib::ParamSpec" objects which are the child properties available for children of a container $object_or_class_name. See Glib::Object "list_properties" for the fields in a ParamSpec. $container->propagate_expose ($child, $event) o $child (Gtk2::Widget) o $event (Gtk2::Gdk::Event) $container->set_reallocate_redraws ($needs_redraws) o $needs_redraws (boolean) $container->remove ($widget) o $widget (Gtk2::Widget) $container->resize_children resizemode = $container->get_resize_mode $container->set_resize_mode ($resize_mode) o $resize_mode (Gtk2::ResizeMode) $container->unset_focus_chain PROPERTIES
'border-width' (Glib::UInt : default 0 : readable / writable / private) The width of the empty border outside the containers children 'child' (Gtk2::Widget : default undef : writable / private) Can be used to add a new child to the container 'resize-mode' (Gtk2::ResizeMode : default "parent" : readable / writable / private) Specify how resize events are handled SIGNALS
add (Gtk2::Container, Gtk2::Widget) remove (Gtk2::Container, Gtk2::Widget) check-resize (Gtk2::Container) set-focus-child (Gtk2::Container, Gtk2::Widget) ENUMS AND FLAGS
enum Gtk2::ResizeMode o 'parent' / 'GTK_RESIZE_PARENT' o 'queue' / 'GTK_RESIZE_QUEUE' o 'immediate' / 'GTK_RESIZE_IMMEDIATE' SEE ALSO
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::Container(3pm)
All times are GMT -4. The time now is 11:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy