Forum: Python 1 Day Ago |
| Replies: 8 Views: 200 use a html parser for this job, such as BeautifulSoup. If you don't want to, then another way is to read the whole html, split on "</div>", go through each element in the list, check for "<div... |
Forum: Python 1 Day Ago |
| Replies: 1 Views: 126 you do it systematically using the same way to read single level dict
d={'AAA': {'KEY1':'text1', 'KEY2':'text2', 'KEY3': 'text3', 'KEY4': 'text4'},
'BBB': {'BBB1':{'KEY1':'text1', 'KEY2':'text2',... |
Forum: Python May 31st, 2007 |
| Replies: 3 Views: 2,386 one method i always use is the os.path.join() method.
dir = os.path.join("C:\\","documents and settings","user","desktop")
starcraftpath = os.path.join(dir,"starcraft.exe")
takes care of the... |
Forum: Python Apr 17th, 2007 |
| Replies: 5 Views: 1,055 if in the file, the content is indeed this:
[1,2,3,4]
then when you read the file line by line, you can use eval() to turn it into a list
for line in open("file"):
alist = eval(line)
... |