- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
5 Posted Topics
How do I read a .txt/.csv file from an internet address? For example: http:\\[url]www.internetaddress.com\file.txt[/url] I don't think file() would work for this. Thanks | |
[ICODE]class classA: #saved as classA.py def __init__(self): print "class A" printB() def printB(): print "B"[/ICODE] [ICODE]>>> classA() class A Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> classA() File "C:\Documents and Settings\Owner\Desktop\timetable\classA.py", line 5, in __init__ printB() NameError: global name 'printB' is not defined[/ICODE] Using the class … | |
How do I use classes in python? Do I import them? For example: class classA: def __init__(self): print "class A" class classB: def __init__(self): classA_list = [] for i in range(5): classA_list.append(classA()) #list of classA objects This works if I have both classes in one file. But if the classes … | |
How do I read something from DOS? For example, doing a command in DOS, like 'dir'/etc. and writing the output to a variable in python? I know about the listdir() function, 'dir' in DOS is just an example. | |
Lists have the append() function to add an item to the end of the list. Is there a similar function to add to the end of dictionaries? Update() doesn't seem to work. Example: >>> a = {'a':'a'} >>> b = {'b':'b'} >>> c = {'c':'c'} >>> a {'a': 'a'} >>> … |
The End.