+ 1

How can I give space in the entered contents if taking user input..??

17th Jun 2018, 1:31 AM
Satyam Mishra
Satyam Mishra - avatar
13 Respostas
+ 6
I checked your code https://code.sololearn.com/cGG83BRthfoZ/#py. It works fine. Because input always generates a string, you never have to say str(input()). input() is all you need.
17th Jun 2018, 1:56 AM
David Ashton
David Ashton - avatar
+ 2
file = open("newfile.txt" , "w") a=str(input ("Enter your Name:")) b=str(input ("Enter your Father's Name:")) file.write(a+b) file.close
17th Jun 2018, 1:50 AM
Satyam Mishra
Satyam Mishra - avatar
+ 2
Thank you sir
17th Jun 2018, 4:37 AM
Satyam Mishra
Satyam Mishra - avatar
+ 1
you can enter multiple words separated by space in this code x = str(input()) print(x)
17th Jun 2018, 1:43 AM
Dinanath Basumatary
Dinanath Basumatary - avatar
+ 1
my program is like this
17th Jun 2018, 1:50 AM
Satyam Mishra
Satyam Mishra - avatar
+ 1
and when I enter the value of a and b there no space left between them in the new.txt file which I opened
17th Jun 2018, 1:51 AM
Satyam Mishra
Satyam Mishra - avatar
+ 1
Output is showing like this : satyammishrakunjbiharimishra
17th Jun 2018, 1:53 AM
Satyam Mishra
Satyam Mishra - avatar
+ 1
okay. use the following: file.write(a, " ", b) or file.write(a+" "+b)
17th Jun 2018, 1:53 AM
Dinanath Basumatary
Dinanath Basumatary - avatar
+ 1
in valid
17th Jun 2018, 1:53 AM
Satyam Mishra
Satyam Mishra - avatar
+ 1
it shows invalid
17th Jun 2018, 1:54 AM
Satyam Mishra
Satyam Mishra - avatar
+ 1
ok ok let me check
17th Jun 2018, 1:54 AM
Satyam Mishra
Satyam Mishra - avatar
+ 1
thanks it's working now
17th Jun 2018, 1:54 AM
Satyam Mishra
Satyam Mishra - avatar
0
where do you want the space? what is your expected output?
17th Jun 2018, 1:51 AM
Dinanath Basumatary
Dinanath Basumatary - avatar