Sunday 15 July 2012

linux - Python: File Reader int and if clauses -


I need some help with Python - I am reading a file with its values ​​in each row. At the moment my code is activated when int (float (rstrstrip ()) == 7. But I want to add additional that 7 should not run any other in each row in the file.

Any thoughts?

Thank you!

Sorry for my english

  import os file = open ("/ home / pi / desktop / autozobes / netidapa" for line in file "," R "): if int (float (line .strustrip) ) == 7: OSSystem ('Sudo Python / Home / PI / Desktop / Auto Jobs / TvOn.py') file.close ()  

/ home / pi / Desktop / AutoJobs / Netdata.py:

  1 2 3 4 5 6 7 (The network is the last part of my device (1902.18.1.x) and I want to turn off the device .7 Not connected - the file updates netdata.py every minute and can happen For example the device .7 is not connected and the number is not listed in the file 7)   

  Import OS found = wrong file = open ("/ home / pi / desktop / autojobs / netdata.py", "R") for the line in the file: if int (float (line .striste)) == 7 : Found = True OSSystem ('Sudo Python / Home / PI / Desktop / Autozobus / T VON' File.close () if not found: Print "Add your code here."  

No comments:

Post a Comment