Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~1K People Reached
Favorite Forums
Favorite Tags
Member Avatar for blacknred

I got a file: [CODE]I wake up in the morning What time? Always wakeup at 6am.[/CODE] what would be an easy way to determine the number of white spaces between each word? Thanks in advance David

Member Avatar for k_manimuthu
0
274
Member Avatar for blacknred

I have a file of format: BRAND VERSION MODEL OPTIONS BOUGHT ------ ------- ------- ------- ---------- toyota lxi 2007 4 years ago nissan mxi 2008 3 years ago Actually the formatting goes awry when I save- So its Brand(toyota nissan under it) VERSION(lxi mxi under it) MODEL(2007 2008) OPTIONS -this …

Member Avatar for blacknred
0
157
Member Avatar for blacknred

I have a share -//192.168.0.11/myshare which has many files in it. Which is the best way to delete all the files in this directory using python? I tried: [CODE]import os folder = '\\192.168.0.12\myshare1' for the_file in os.listdir(folder): file_path = os.path.join(folder, the_file) try: if os.path.isfile(file_path): os.unlink(file_path) except Exception, e: print e[/CODE] …

Member Avatar for jice
0
126
Member Avatar for blacknred

Hi, I have this cvs file comprising of hex values. But my objective is to have them all converted to normal base 10 Dec format. myfile.csv [QUOTE]0x0000004d,0x00005275,0x37106800,0x000008a2,0x000009a2 0x0000004d,0x00005275,0x370d4e00,0x000008a2,0x000009a2 0x0000004d,0x00005275,0x37106800,0x000008a2,0x000009a2 0x0000004d,0x00005275,0x370d4e00,0x000008a2,0x000009a2[/QUOTE] I tried [CODE]for line in open('myfile.csv'): for word in line: word = int(word,16)[/CODE] word = int(word,16) ValueError: invalid literal for …

Member Avatar for e-papa
0
169
Member Avatar for blacknred

Hi, I'm trying to 'grep' the string which comprises of all non-zero values [B]0x0000000a[/B] in this case. [CODE]>>> match = re.search('0x0000000[1-9,a-z]', "My values are value=0x00000000 0x00000000 0x0000000a 0x00000000 0x00000000 0x00000000")[/CODE] This works but in this case, but not over any string as in if example is: [QUOTE]"My values are value=0x00000000 …

Member Avatar for blacknred
0
85
Member Avatar for blacknred

I'm trying to do some simple parsing as example: [code]import csv import os,sys spamWriter = csv.writer(open('eggs.csv', 'wb'), delimiter=' ',quoting=csv.QUOTE_MINIMAL) string = "cat /home/myfile.txt |grep -m 1 "my game" " string2=os.system(string) spamWriter.writerow([string2]) [/code] [quote]home]# python excel2.py File "excel2.py", line 4 string = "cat /home/myfile.txt |grep -m 1 "my game" "[/quote] ^ …

Member Avatar for TrustyTony
0
162
Member Avatar for blacknred

Hi, I'm intend to do the following -do a calculation ; record the value with timestamp to excel (csv format will do) -repeat above step; append a new row to csv with newly calculated value and timestamp. ... ... continue in endless loop. Could someone give me some pointers on …

Member Avatar for richieking
0
80
Member Avatar for blacknred

I'm trying to parse xml file and convert all the unix timestamps in it to datetime... [QUOTE]<Sample> <TimeStamp>1291052077</TimeStamp> blah blah blah blah </Sample> <Sample> <TimeStamp>1291052077</TimeStamp> blah blah blah blah </Sample> </Content>[/QUOTE] [CODE]import fileinput file = raw_input("Enter file: ") file = open(file, "wb+") for line in fileinput.FileInput(file,inplace=1): if "TimeStamp" in line: …

Member Avatar for richieking
0
179
Member Avatar for blacknred

Hi I just started with python, and trying to implement some system admin tasks and running into some rough. Basically I need to do some task on whichever share exists on their corresponding server. eg Server A has shares 1,2 and 3 Server B has share 1 and so on. …

Member Avatar for blacknred
0
86