0

I'm writing a scrip for stress testing, the file i'm reading from is my input and it's a text file. Ideally I will be iterating the list of address to perform an stress test. The problem stems with the input, it's inefficient as a space won't be processed.

I'm having an odd glitch, my output works but it add odd spaces.

I've tried readlines(), but it yields the same result.

file = open('ip.txt', 'r') 
for line in file:
    print (line)

// Current OUTPUT
>> X.X.X.X
>> 
>> Y.Y.Y.Y
>> 

// Desired OUTPUT
>> OUTPUT:
>> X.X.X.X
>> Y.Y.Y.Y

thank You,

2 Answers 2

1

you can do like that:

file = open('ip.txt', 'r').readlines()
for line in file:
   lines = line.rstrip()
   print lines
Sign up to request clarification or add additional context in comments.

2 Comments

OMG UR AWESOME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! thank you!!!!!!!!!!!!!!!!!!!!!! WORKS PERFECTLY!
@UsualSuspect7 you can also accept my answer if that helped you =-)
0

it works for deleting /n problems

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.