Python Forum
Exporting Python Output to Notepad
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exporting Python Output to Notepad
#1
Hi
i am trying create a file in Python 2.6.6. Its working in Python 2.7

fp = open('command_file.txt', 'w')
fp.write(device1 + '#' + intstatus + '\n' + device1 + '#\n')

command_file.txt is not being created when i run in Python 2.6.6 . any idea how to fix it up ?
Reply
#2
I don't see anything obvious wrong, but more information would be helpful. What are device1 and intstatus? Are you getting an error, or is there just no file? If you're getting an error, what is the full text of the error? Are you running it exactly the same in the two versions (that is, could the current working directory be different, so that the relative file path is pointing to an unexpected location?
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
i m not getting any error..but i dont see that file.Running exactly the same code and i am login to root... i tried

10:57:03 # find . -name command_file.txt

no luck....
Reply
#4
Okay, then what exactly are device1 and instatus? If they are the wrong type that could be interfering with the write command.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
i was returning the output to list before it was getting written in .txt..fixed that.. thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Exporting Stock Fundamental Data to a CSV file with yahoo_fin DustinKlent 2 4,637 Aug-01-2022, 06:08 PM
Last Post: paulyan
Question Trouble installing modules/libraries and getting Notepad++ to show cyrillic letters Dragiev 6 2,179 Jul-24-2022, 12:55 PM
Last Post: Dragiev
  Exporting dataframes to excel without loosing datetime format Rafa 0 1,212 Oct-27-2021, 10:42 AM
Last Post: Rafa
  Exporting a huge dataFrame stylingpat 5 15,264 Mar-23-2021, 12:13 AM
Last Post: stylingpat
  exporting all lines YazeedbnMohmmed 2 2,075 Feb-24-2021, 03:29 AM
Last Post: YazeedbnMohmmed
  Python code for exporting table using Selenium gj31980 4 2,932 Aug-04-2020, 01:29 AM
Last Post: gj31980
  Exporting data from python into excel Zankawah 5 3,306 Jun-02-2020, 03:17 AM
Last Post: buran
  Variable from notepad problem samuelbachorik 2 2,259 Apr-10-2020, 09:04 AM
Last Post: samuelbachorik
  Exporting list with dictionary to Excel veromi22 0 3,011 Oct-15-2019, 12:54 AM
Last Post: veromi22
  Exporting to Excel Nirmal 5 2,688 Aug-08-2019, 12:22 PM
Last Post: Nirmal

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020