Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 944283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:34:05+00:00 2026-05-15T22:34:05+00:00

The could below doesnt write to the text file as it should: import re

  • 0

The could below doesnt write to the text file as it should:

import re

download_results = open('download_result.txt', 'w')
s = 'AAAAAAABBBBCDEEEEEFFFFFFFFFFFFFGGGGGGGGGGGG##GGGGGGHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIJJJJJJJJJJJJJJKKKKKKKKKKKKLLLLLLLLLLLLLLLLMMMMMMM&&MMMMMMMMNNNNNNNNNNNNOOOOOOOOOOOO'
s = re.sub(r'[^\w]','',s)
s = ''.join(s)
for i in range(0, len(s), 60):
    download_results.write('%s' % (s[i:i+60]))
download_results.write('\n\n')
download_results.close()

The output in the text file is:

AAAAAAABBBBCDEEEEEFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIJJJJJJJJJJJJJJKKKKKKKKKKKKLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMNNNNNNNNNNNNOOOOOOOOOOOO

But i would like the output to be:

AAAAAAABBBBCDEEEEEFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGHHHHHHHHHHH
HHHIIIIIIIIIIIIIIIIIJJJJJJJJJJJJJJKKKKKKKKKKKKLLLLLLLLLLLLLL
LLMMMMMMMMMMMMMMMNNNNNNNNNNNNOOOOOOOOOOOO

Where the script writes “S” in lines containing 60 characters.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:34:05+00:00Added an answer on May 15, 2026 at 10:34 pm

    Change this:

    download_results.write('%s' % (s[i:i+60]))
    

    to this:

    download_results.write('%s\n' % (s[i:i+60]))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How could I change the text below so that the text within it has
I could see the below entries in the ULS log 02/08/2010 14:36:46.12 w3wp.exe (0x15F4)
Could you please have a look at my code below. #!C:\Perl\bin\perl.exe use strict; use
Below is my table, a User could have multiple profiles in certain languages, non-English
Can anyone guide me what could be the problem in the mentioned below:- alt
For the form below, how could I make the input field big, like maybe
Given the example below, can someone please show me how this could be called?
Given the Java code below, what's the closest you could represent these two static
i'm getting the below error, When compiling the Asp.Net web deploy project Could not
I have a problem for querying records into mysql explanation below The user could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.