Python Forum
How to save some results in .txt file with Python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to save some results in .txt file with Python?
#1
hello. I have this Python code, that makes a Parsing. But I want to save the results in the save.txt file. How can I do that? How to save python screen output to a text file? I am using PyScripter.

Quote:from urllib.request import urlopen
from bs4 import BeautifulSoup

html = urlopen("http://www.pythonscraping.com/exercises/exercise1.html")
bsObj = BeautifulSoup(html, "html.parser")
print(bsObj.title)
print(bsObj.h1)
Reply


Messages In This Thread
How to save some results in .txt file with Python? - by Melcu54 - May-25-2021, 08:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Open/save file on Android frohr 0 317 Jan-24-2024, 06:28 PM
Last Post: frohr
  Updating sharepoint excel file odd results cubangt 1 825 Nov-03-2023, 05:13 PM
Last Post: noisefloor
  how to save to multiple locations during save cubangt 1 544 Oct-23-2023, 10:16 PM
Last Post: deanhystad
  save values permanently in python (perhaps not in a text file)? flash77 8 1,207 Jul-07-2023, 05:44 PM
Last Post: flash77
  Save and Close Excel File avd88 0 3,023 Feb-20-2023, 07:19 PM
Last Post: avd88
  Trying to send file to printer with no results. chob_thomas 2 3,369 Dec-21-2022, 07:12 AM
Last Post: Pedroski55
  Save multiple Parts of Bytearray to File ? lastyle 1 941 Dec-10-2022, 08:09 AM
Last Post: Gribouillis
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,370 Sep-27-2022, 01:38 PM
Last Post: buran
  How to format EasyOCR results in order to save to CSV? cubangt 0 1,254 Sep-02-2022, 02:06 PM
Last Post: cubangt
  [split] Results of this program in an excel file eisamabodian 1 1,575 Feb-11-2022, 03:18 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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