woooee 814 Nearly a Posting Maven

You haven't recieved many answers, and probably won't because your examples are incomplete. You are obviously doing something in the code that is not posted that alters the result. Take a look at the following code that is a complete program that can be run. It shows that your contention does not hold up, at least as far as I can tell from what has been posted. You may be re-defining variables or it may be a scope problem, but there is no way to tell from the snippets that were posted. Also, this bit of code

result = checkAnswer("C", userAnswer)
    if(result):
    #if answer is incorrect, display message as such
        wrongAnswer()

will not even run because of improper indents.

def change_bool(bool_arg):
   bool_arg = not bool_arg
   print "in first function", bool_arg     ## prints 'False'

def change_2():
   test_1 = False
   print "in 2nd function", test_1     ## prints 'False'

test_1 = True
change_bool(test_1)
print "first", test_1     ##(prints 'True')
change_2()
print "second", test_1     ##(prints 'True')
woooee 814 Nearly a Posting Maven

I'm a little confused- how are the lines getting saved (and as what)?
Thanks!

You can use readlines() to read the entire file into a list

Try a
print type(input_data)
print input_data
to see what it contains

woooee 814 Nearly a Posting Maven

You can use readlines() to read the entire file into a list and then access it any way you want.

input_data = open(file_name, "r").readlines()
stop = len(input_data)
for ctr in range(0, stop):
   print "This record is", ctr, input_data[ctr]
   if ctr+1 < stop:
      print "Next record is", ctr+1, input_data[ctr+1], "\n"

Note that you do not have to close a file using the open+readlines method. Python's garbage collection will do that automatically.

woooee 814 Nearly a Posting Maven

3. For Linux .
What the difference between ( #! = user/bin/python , #! = user/bin/env python) ?

"/usr/bin/python' looks for the python executable in /usr/bin
"/usr/bin/env python" searches the environment ($PATH) for the python executable

2. How to make path for Linux ? using user ?

Do you mean you want add a path used to search for imported programs? If so, that is
sys.path.append('name/of/path')
If you want to make a new directory (not a path) see here http://www.google.com/search?client=opera&rls=en&q=python+make+directory&sourceid=opera&ie=utf-8&oe=utf-8

woooee 814 Nearly a Posting Maven

These exist in /usr/local/lib/Python2.5 and /usr/local/lib/Python2.6
Also in /usr/local/lib exists Tcl8.5 and Tk8.5

/uar/local/lib is not always in $PATH (enter $PATH in the terminal and see what prints).
You can key in
export PATH=$PATH:/usr/lib/:/usr/local/lib:/usr/local/bin
or whatever you want to add, and also add that line to the ~/.bashrc file so it will be added whenever you log in. You could also try Active State's version as it comes with Tkinter and Tix http://www.activestate.com/activepython/

woooee 814 Nearly a Posting Maven

inputs[0] could only be one word, since you split the raw_input, so the code would be

if inputs[0].lower() == 'monster:
##  or
test = inputs[0].lower()
if test == 'attack':
            actions.attack(enemy, player, menus)
elif test == 'equip':
            actions.equip(player, inputs[1])  ## inputs[1] will not exist
elif test == 'monster':
            print_monster_stats(enemy)
woooee 814 Nearly a Posting Maven

Post the error message and the line it came from and we'll see if we can get to the bottom of this. You might want to put a try/except around that part of the code and see if you get any more info.

try:
   ## code goes here
except:
   import traceback
   traceback.print_exc()
   raise
woooee 814 Nearly a Posting Maven

File "E:\Tom's Personal Project\src\gamemain.py", line 44, in attack
******************************************************
menus.combat_menu(enemy, player, self)
******************************************************
TypeError: combat_menu() takes exactly 5 arguments (4 given

combat_menu is defined as
def combat_menu(self, enemy, player, actions, menus):
The error message says that you only sent it 3 args (+ the class's self) and only two of the args are correct.

saying that I misspelt a variable 'Item' as 'item' even though I can see the correct spelling infront of me

Python does not lie to you. You have mis-spelt the variable name. Take another look at the program name and line number in the error message. You are either looking in the wrong program or at the wrong line. Or it is on the line 2 or more times and you are only looking at one of them. Some advice gained from experience. Always say "how did I screw up this time" and never "this program/computer isn't doing this right". It's never the computer, its always us.

woooee 814 Nearly a Posting Maven

[(a, alist.count(a)) for a in set(alist)]

A nice solution. Convert to a set to eliminate duplicates and then count each one. It still requires that the list be processed as many times as there are integers in the set, and would yield the results in hash table order, but the list of tuples could be easily sorted.

woooee 814 Nearly a Posting Maven

Not that I know of. You would have to use a dictionary with the integer as a key, with the value being a counter integer that you would increment each time. There is a count function for lists that would return the number of times something occurs in a list, but you would have to process the entire list however many times you count, instead of once, and you would have to keep track of what counts have already been done so you don't do them twice, and there are probably other problems that make count() more trouble than it is worth for this particular case. The other solution would be to sort the list and count until you find a difference, then print, rinse and repeat.

woooee 814 Nearly a Posting Maven

This is pretty straight forward and done quite often. It assumes, of course, that the file is already in a sorted order. First, declare an empty list to store the records in. Read the file one record at a time and extract the two fields you want to compare. If the two fields that you want to test are not equal to the previous record's, then send the list to a function which can do whatever you want to process the previous group of records in the list. Now declare the list as empty, once again, and append records until you hit the next break. Note that you will have to send the final list to the processing function after the read loop, as the final group of records have not been processed.

woooee 814 Nearly a Posting Maven

I would suggest declaring the variable in the main class and passing that class's instance to the other classes so they have access to it, or using a separate class for variables and then passing that instance to it, which is essentially the same thing. See the second example below. You can also use a variable as a class reference as in the first example below, but my personal preference is to use the second example. Also, by "main thread" I am assuming that you mean "main calling program" and are not using threads or threading with is another matter entirely. That would probably require multiprocessing and passing a list to the program, because a list is passed by reference so the same list is referenced to all of the programs.

class MainClass:
   var = 1
   def __init__(self):
      self.var2 = 3

class Class_A:
   def __init__(self):
      print MainClass.var

class Class_B:
   def __init__(self, MC):
      print MC.var2

CA = Class_A()
MainClass.var = 2
CA = Class_A()
##
print "\nsecond way"
MC = MainClass()
CB = Class_B(MC)

Edit: A third way, of course, is to use an SQLite DB to store the variable and have all programs check for updates.

woooee 814 Nearly a Posting Maven

Monks brewing beer in the Middle Ages were allowed to drink five quarts of beer a day.

One would guess that shortly thereafter the vow of slience and loose robes became popular.

woooee 814 Nearly a Posting Maven

There was a story in Southern California a few years ago when the founder of the Flat Earth Society died (where else would it be from). They believe that the moon walk, etc. was produced in Hollywood. The original website offered a statement from the wife of the founder, as "proof" that the world is flat. It was something like, she was originally from Australia and had never hung upside down on the bottom of the earth. A Google shows that this society is still alive and well, but now on alaska.net http://www.alaska.net/~clund/e_djublonskopf/Flatearthsociety.htm As a co-worker says, 'Alaska is the new South'. but this is also how we know that we live in a free country.

woooee 814 Nearly a Posting Maven

and so on until the last line is my fully sorted data

No way to tell without any code. For example, what is "sort_ouput"? It appears to be a function, but then it would be "sort_output()". It also appears that you are printing the record and then adding it to the existing records, then writing the corrupted data to a file. You can either write at the same spot you print, and use the same data, or post some code so someone can help with it.

woooee 814 Nearly a Posting Maven

You use a Tkinter.StringVar(). This is not what you are doing, but a program I have lying around. The string variable is attached to both the entry box and the label, so they change as the StringVar changes.

import Tkinter

class EntryTest:
   def __init__(self):
      self.top = Tkinter.Tk()

      self.str_1 = Tkinter.StringVar()
      label_lit = Tkinter.StringVar()

      label_1 = Tkinter.Label(self.top, textvariable = label_lit )
      label_1.pack()
      label_lit.set( "Test of Label")
    
      label_2 = Tkinter.Label(self.top, textvariable = self.str_1 )
      label_2.pack()

      entry_1 = Tkinter.Entry(self.top, textvariable=self.str_1)
      entry_1.pack()
      self.str_1.set( "Entry Initial Value" )

      cont = Tkinter.Button(self.top, text='PRINT CONTENTS',
             command=self.getit, bg='blue', fg='white' )
      cont.pack(fill=Tkinter.X, expand=1)

      exit=  Tkinter.Button(self.top, text='EXIT',
             command=self.top.quit, bg='red', fg='white' )
      exit.pack(fill=Tkinter.X, expand=1)

      entry_1.focus_set()
      self.top.mainloop()

   ##-----------------------------------------------------------------
   def getit(self) :
      print "getit: variable passed is", self.str_1.get()

##===============================================================

if "__main__" == __name__  :
   ET=EntryTest()
woooee 814 Nearly a Posting Maven

Whne do you declare x and what happens if it is the first time through and x is empty (it will never process no matter how many times you run it because of "if x:"). Generally "gold" is passed as an iteger to the function and returned. This example subtracts instead of adds to make a point as your code will rarely be anything other than x or gold > a.

def gold_keeper(x):
    a = 200
    if x >= a:
        x -= a
        print x
    else:
        print "You don't have enough gold, %d <= %d" % (x, a)
    return x

gold = 250
gold = gold_keeper(gold)
print "\nFirst Test and gold =", gold
gold = gold_keeper(gold)
print "\nSecond Test and gold =", gold"
woooee 814 Nearly a Posting Maven

How would I get it to read the 'a' again?

You would use the string.find() function. It returns the location of the string if found, or -1 if not found, and can take a second, optional argument that is the starting position for the search. So you would add one to the starting position of the found sub-string, i.e if it is greater than -1, and search again.

def count(sub, strng):
     sub_count = 0
     found = strng.find(sub)
     while found > -1:
         sub_count += 1
         print "found is", found
         found = strng.find(sub, found+1)

     return sub_count

print count('ana', 'banana')
woooee 814 Nearly a Posting Maven

Or print every 3rd element and then print the length of the list.

woooee 814 Nearly a Posting Maven

It appears that you are using "text" twice.

##--- here "text" is the list of records from the file
    text = file.readlines()
    file.close()

    keyword = re.compile("searchword")

##--- here you are reading from the list of records which is named "text"
    for line in text:
        result = keyword.search (line)
        if result:
##--- here you are trying to "INSERT, '\n' + line" into the
##     list named "text", which can not be done
            text.insert(INSERT, '\n' + line)
woooee 814 Nearly a Posting Maven
while n:
       num = n % 10
       squares = num*num
       n = n / 10

"while n:" evaluates to True/False. If n==0, then it is False, otherwise True (for both positive and negative numbers). So you would have an infinite loop, except for the fact that that you are using integers, so a some point n will equal one and the next pass will round to zero using integers. Anyway, this is not a good way to do this as you missed an infinite loop by luck only, and hopefully you now understand while loops a little better.

woooee 814 Nearly a Posting Maven

This should print the matches once only but it is untested.

nextrow = 0
thisrow = 0
prev_number = ""
while thisrow < listmax-1:
    nextrow = thisrow + 1
    this_record = edgelist1[thisrow]
    while (nextrow < listmax) and \
            (this_record[0]==edgelist1[nextrow][0]):

       ##  print new number
       if this_record[0] != prev_number:
           print ("\n-----", this_record[0])
           prev_number = this_record[0]

       print (thisrow, this_record[1], nextrow, edgelist1[nextrow][1])

       ##   skip over these records
       thisrow = nextrow
       nextrow=nextrow+1
    thisrow += 1
woooee 814 Nearly a Posting Maven

Your original code will give results until it finds a record that does not match, and not necessarily all of the matches. It is also redundant. You print
ANTIMICROBIAL RESISTANCE CARRIAGE
ANTIMICROBIAL RESISTANCE EXPERIENCE
because they are all equal, then you print
CARRIAGE EXPERIENCE
which is a duplication of the first printing. I don't know if this is what you want or not.

The problem with the original code is that it has to process the file many, many times. That is, each record is compared with every other record (potentially). If the program doesn't take too long to run, then this is OK. Otherwise you want to process the file in one pass. The best way to do this is probably to place the records in a dictionary of lists, where the key is the number, pointing to a list of lists, each list containing whatever you want, the description and the record number perhaps. You then extract any key that has more than one entry. Post the first 10 or so records if you want any more help, as the code snippet that I posted should work for the 3 record examples in your first post.

If you want to use the while() statement then you must test for end of file

while (nextrow < listmax) and \
      (edgelist1[i][0]==edgelist1[nextrow][0]):
woooee 814 Nearly a Posting Maven

Duplicate post removed.

woooee 814 Nearly a Posting Maven

In addition to/instead of printing the file name, send the file name to another function at that point and that function can do whatever you want with that file.

woooee 814 Nearly a Posting Maven

The error is in this line
print (edgelist1[1],edgelist1[nextrow][1])
when you get to the last record, nextrow points beyond the end, so you want to use
for i in range (0,listmax-1):
since there is nothing to compare the last record to. Alternatively, you can use
for i in range (1, listmax):
and compare this record to the previous record. Also you want to be sure that the records are in numerical order, otherwise sort them first.

Second, you do not need the while loop, as the for loop goes through all of the records, and you could get duplicate output, one from the while loop, and one from the for loop. You can then print the index value from the for loop which is also the record number (or index+1 if you want the first record to be one instead of zero). Finally, it is bad practice to use "i", "l", or "o" as single digit variable names as they can look like numbers.

for x in range (0,listmax-1):
    nextrow=x+1
    if edgelist1[x][0]==edgelist1[nextrow][0]:
       ##   how this print statement should be formated depends on
       ##   the Python version you are using
       print ("rec # %d  %s  %s" % (x+1, edgelist1[x][1], edgelist1[nextrow][1]))
woooee 814 Nearly a Posting Maven

so i wan(t to) use endswith Main Page.txt to search

Post the code that reads the directory and your usage of endswith. I don't see a problem here, i.e. read the directory and go through the list to see if the file name ends with whatever.

woooee 814 Nearly a Posting Maven

It is speculated that the first drinking straws were made by ancient Egyptian brewers. They needed to taste beer that was still brewing, without disturbing the fermenting ingredients floating on the top.

woooee 814 Nearly a Posting Maven
data=line.split()
maxval=data[0]

because you are using strings instead of integers. So converting to an integer would look like this.

file_in = open( 'cont.dat',"r")
data_in=file_in.readlines()
file_in.close()
coloumn=[]
for line in data_in:
    data=line.split()
    ncoverage=len(data)

    ##   convert to integer
    maxval=int(data[0])

    maxid=0
    for j in xrange(0,ncoverage,1):

        ##   convert to integer
        if int(data[j])>= maxval:
            maxval=int(data[j])
    print maxval
woooee 814 Nearly a Posting Maven

This question is better asked/searched on Ubuntu's forums. The answer is something in the neighborhood of copying the 3.0 install and changing to 3.1, to or use apt-get's install from source-I haven't done it but this might help https://lists.ubuntu.com/archives/ubuntu-users/2005-July/042275.html
http://www.debian.org/doc/manuals/apt-howto/ch-sourcehandling.en.html

If you do install from source, (not the same as using apt-get to install from source), read the README file, as you have to do something like "make alt-install" otherwise it could overwrite an existing Python install instead of installing in a separate library directory.

woooee 814 Nearly a Posting Maven

If your OS has some kind of socket support to communicate between processes then you can use that. You could also do something like letting an SQL file take care of the locking issues, and have one or both programs write to file and the other check periodically for updates, but that is definitely a hack.

woooee 814 Nearly a Posting Maven

Read the directory and then use os.stat to get file info. You will probably want to use one of st_atime, st_mtime, or st_ctime depending on which OS system you are on.

woooee 814 Nearly a Posting Maven

the moment the thread is killed, a sys.exit() is sent to main thread and the whole program exited. I am still trying to figure out how I can avoid that.

You can use multiprocessing for Python versions > 2.5, but you have to install it for 2.5 and below (named pyprocessing) http://developer.berlios.de/projects/pyprocessing
An example which kills the process after 5 seconds but lets the program continue to run. Note that this works the same if you are using an infinite while() loop or anything else.

import subprocess
import time
from processing import Process

class TestClass():
   def test_f(self, name):
      subprocess.Popen("ping www.google.com", shell=True)
         
if __name__ == '__main__':
    CT=TestClass()
    p = Process(target=CT.test_f, args=('P',))
    p.start()

    ## sleep for 5 seconds and terminate
    time.sleep(5.0)
    p.terminate()

    print "\n program is still running"
woooee 814 Nearly a Posting Maven

This type of thing generally used for creating a menu using a dictionary. An example of a menu using eval() to call the function:

def func_1():
   print "     func_1 test"
def func_2():
   print "     func_2 test"
def func_3():
   print "     func_3 test"
def func_4():
   print "     func_4 test"

##----------------------------------------------------------------
##   dictionary = list of function to call and menu choice to print
menu_d = { 1:['func_1()', '1)Load'], 
           2:['func_2()', '2)Save'], 
           3:['func_3()', '3)Add Phone Number'],
           4:['func_4()', '4)View Phone Number'],
           5:["", "5)Exit"]}
choice = 0
while choice != 5:
   print "\nSelect an Option\n"
   for j in range(1, 6):
      print menu_d[j][1]   ## print list's element #1 for key=j

   choice = int(raw_input( "Enter choice, 1-5 " ))
   if choice in menu_d:
      dict_list = menu_d[choice]
      eval(dict_list[0])
      ## eval(menu_d[choice][0])   will also work
print "\nend of program"
woooee 814 Nearly a Posting Maven

delimited by "\t", "," or " ". If it is any of these, I want to keep the line

Just test for any one in a line.

if ("\t" in line) \
or ("," in line) \
or " " in line:
    print "keep this line", line
woooee 814 Nearly a Posting Maven

The problem may be in the code below. In the first case, if user_input == '', you are passing a file name with the corresponding directory(s). In the second case, "else", you are passing the directory only, that was input by the user. This type of problem is generally a bad path, so break the code into pieces by commenting what you don't want, and print the file and path name everywhere you use it.

if __name__ == "__main__":
    print os.getcwd()
    if user_input == '':
        for root, dir, files in os.walk(os.path.abspath(os.path.dirname(sys.argv[0]))):
            filelist = [ os.path.join(root,fi) for fi in files ]

        for track in filelist:
            rmtrcknum(track)

    else:
        rmtrcknum(user_input)

You perhaps want something like this but I am not sure what user_input or sys.argv is so you may have to adjust.

if __name__ == "__main__":
    print os.getcwd()
    path_name =user_input
    if user_input == '':
        ## print sys.argv and see what it prints
        path_name = sys.argv[1]   ## you want [1]

    for root, dir, files in os.walk(os.path.abspath(os.path.dirname(path_name))):
        filelist = [ os.path.join(root,fi) for fi in files ]

    for track in filelist:
        rmtrcknum(track)
woooee 814 Nearly a Posting Maven

Did you ever thought of doing your work yourself?
I could find the recipe from active state

Obviously not (something like "This is __not__ freeprograms.com" should be displayed prominently on the website). I try to follow the rule that when a question is asked with words, I respond with words. And similarly, code with code.

woooee 814 Nearly a Posting Maven

Generally you use the table widget. I don't use Tkinter much but try tablelist http://www.nemethi.de/ and the tablelistwrapper for Python http://tkinter.unpythonic.net/wiki/TableListWrapperpython You pass it the headings, and then the data as a list of comma separated values.

woooee 814 Nearly a Posting Maven

when I try to remove a single appearance of a number from a square, the number is removed from all the squares in the grid

Generally that means that you are not declaring a list of independent lists but a list of references to the same list. Show us how you are creating "grid", and/or loop through and print id(this_sub_list) and see if the addresses are the same.

##---  This declares a 3X5 list and prints the memory address
grid = []
for j in range(0, 3):
   grid.append([ [] for x in range(5) ])
print grid

for j in range(0, 3):
   for k in range(0, 5):
      print id(grid[j][k])

Edit: Based on shadwickman's post, you probably did something like

##--- declare a 1X3 list for testing
grid = []
sub = []
for j in range(0, 3):
   grid.append(sub)
print grid

for j in range(0, 3):
   print id(grid[j])     ## they are all the same
woooee 814 Nearly a Posting Maven

A quick look says that classes/__init__() requires parens, i.e.

g.QuitButtonBB()

If that does not solve the problem, then post back. And "(code = python)" evidently does not work. Use the plain old "(code)" instead.

woooee 814 Nearly a Posting Maven

Having one list like L1 =
need to do pop operation and assign value like,
z1 = L1.pop()
z2 = L2.pop()
z3 = L3.pop()

In Python you do not have to reassign the value. Use the list values, unless you reassign for some other reason.

list_1 = ['a', 'b', 'c', 2, [3, 4, 5] ]
print list_1[-1]
##
el = len(list_1)
while el > 0:
   el -= 1
   print list_1[el], type(list_1[el])
woooee 814 Nearly a Posting Maven

by putting the cursor to the end of the
for c in chartNames:
and pressing an enter I get compile error.

"I get a compile error" is too vague for anyone to figure out. It is probably that the blank line is not indented at the same level as the other lines and your editor does not like that (which is overly picky, but at the discretion of whoever wrote the editor), but as I said it is impossible to decipher without the line number of the error and what it is. Use try/except, especially when testing.

try:
    for c in chartNames:
        chartUrl = baseChartUrl+c
        hd = extractChart(chartUrl)
 
        writeChart(hd,c)
 
        for key in hd:
            if key in chart:
                chart[key].append(c)
            else:
                chart[key] = [c]
except:
    import traceback
    traceback.print_exc()
    raise
woooee 814 Nearly a Posting Maven

And if you want to follow along with your first idea, you have to return the total if you want to access it outside the function.

def test(l):
    total = 0
    number = input("Number: ")
    for count in range(1, number+1):
        value = (count) * 20
        print "value =", value
        total += value
    print "The total =", total
    return total

## for what it's worth, since you multiply by 20, you can just add 
## up the range and multiply that by 20 as well.
woooee 814 Nearly a Posting Maven

And the following works fine for me, so it may have something to do with the regex as stated above. Try running the code with the "re.sub" line commented and see if that makes a difference.

s = u'La Pe\xf1a'         
print s.encode('latin-1') 

x = u"Rash\xf4mon"
print x.encode('iso-8859-1') 

##-----prints-----
La Peña                                                                 
Rashômon
woooee 814 Nearly a Posting Maven

EDIT: it's not the print statement that is failing.
Sometimes the except statement runs for no apparent reason even after the self.cursor.execute completes

Which means it is the print statement that is causing the error. Break it up to see which part is the problem (which should make it obvious since you are only printing one variable). Without a proper error message there is no way to debug, so note the addition of the traceback.

def db_insert(self,query_string,*params):
        try:
            self.cursor.execute(query_string, params)
            print ("Inserted into: "),
            print(self.database) 
        except:
            import traceback
            traceback.print_exc()
            raise
            print("!!!!WARNING!!!! Insertion into "+self.database+" failed.\n")
woooee 814 Nearly a Posting Maven

Something like

item.replace('/', '') for list[1]

Instead of scanning the whole list, it looks specifically at the line which I know will contain the backslash.

What happened when you tried it?

woooee 814 Nearly a Posting Maven

You use a StringVar and include the function in the class. Here is a simple example. Note that the same StringVar is used for the second label and the entry box. Take a look at this page http://infohost.nmt.edu/tcc/help/pubs/tkinter/control-variables.html

import Tkinter

class EntryTest:
   def __init__(self):
      self.top = Tkinter.Tk()

      self.str_1 = Tkinter.StringVar()
      label_lit = Tkinter.StringVar()

      label_1 = Tkinter.Label(self.top, textvariable = label_lit )
      label_1.pack()
      label_lit.set( "Test of Label")
    
      label_2 = Tkinter.Label(self.top, textvariable = self.str_1 )
      label_2.pack()

      entry_1 = Tkinter.Entry(self.top, textvariable=self.str_1)
      entry_1.pack()
      self.str_1.set( "Entry Initial Value" )

      cont = Tkinter.Button(self.top, text='PRINT CONTENTS',
             command=self.getit, bg='blue', fg='white' )
      cont.pack(fill=Tkinter.X, expand=1)

      exit=  Tkinter.Button(self.top, text='EXIT',
             command=self.top.quit, bg='red', fg='white' )
      exit.pack(fill=Tkinter.X, expand=1)

      entry_1.focus_set()
      self.top.mainloop()


   ##-----------------------------------------------------------------
   def getit(self) :
      print "getit: variable passed is", self.str_1.get()

##===============================================================

if "__main__" == __name__  :
   ET=EntryTest()
vegaseat commented: right on +12
woooee 814 Nearly a Posting Maven

Because of the slash it gets a little tricky. I have found using split to be more reliable.

name_list = ['adam', 'bill', 'jon/juan']
list_2 = []
for this_name in name_list:
      substrs = this_name.split("/")
      each_name = "".join(substrs)
      print each_name
      list_2.append(each_name)
print "list_2 =", list_2
#
##--------------  or ------------------------------
list_3 = []
for each_name in name_list:
      list_3.append("".join(each_name.split("/")))
print "list_3 =", list_3
woooee 814 Nearly a Posting Maven

You can do this two different ways.

items = {'sword':['sword', 3, 15],
             'axe':['axe', 5, 25],
             'bow and arrow':['bow and arrow', 4, 20]}

##---- the easiest to understand
for key in items:
   print "key =", key
   weapon_list = items[key]
   print "\tweapon_list =", weapon_list
   print "\tprice =", weapon_list[1]
   print "\tdamage =", weapon_list[2]
   
##--- the way you tried to do it
for key in items:
   print items[key][0]
   print '\tprice:', items[key][1]
   print '\tdamage:', items[key][2]
Ene Uran commented: good explanation +7
woooee 814 Nearly a Posting Maven

Take a look at the GPL FAQ, especially the sections on modifing existing GPL programs vs. linking to GPL binaries. We are talking about an aggregate, specifically different programs with different licenses in the same package.

An “aggregate” consists of a number of separate programs, distributed together on the same CD-ROM or other media. The GPL permits you to create and distribute an aggregate, even when the licenses of the other software are non-free or GPL-incompatible. The only condition is that you cannot release the aggregate under a license that prohibits users from exercising rights that each program's individual license would grant them.

So they have certain rights for the GPL portion, which you can not prohit them from using, and different rights for any non-GPL code that you also can not prohibit in any way. The bottom line is that you own any program that you create (without copying from others). In most countries today, no one can force you to do anything do don't want to do with it