1
First I asked the user to enter the amount of links that he wanted to add to the file (in this case a string), hence if for example he type 4, I want to ask the question "Download link: " four times to it and add all the answers to that question in a string. How do I do that?
Code:
c=input("Quantos links de download deseja colocar: ")
print("")
dw=input("Link de Download: ")
Then he takes every answer and adds to a string end as one string.
Perfect bro, I just need to make some adjustments, but this code was excellent, because I understood everything. I’m just going to adapt to the software.. It was really worth
– Leonardo
Returning to the problem, the bad thing is that it keeps reusing the variable "text" and then records only the last link typed and how do I add this generated string at the end of another string? I’ll put my code in another comment, by organization
– Leonardo
I’m using
link = "[hide][url=" + dw + "][b]GSMFans-"+ nm + " - Link" + str(i) + "[/b][/url][/hide]"
to generate the link.. so how to add this to another string, and how to not lose the previous links? I can’t use lists because [] and commas will get in the way– Leonardo
No, it records everyone in the string. It’s not very organized but it’s what I said, you’ll have to adapt to what you need. I’m even going to change a little because there was a little mistake. I’ll give you a hint, when you ask a question, put all the important details in it. Now you’re talking about other things that weren’t in the question. Anyway, I can try to help a little more if I understand what your problem is.
– Maniero
Ah, sorry I understood, in my code I had not put text = text ... or text += ... so I only recorded the last one.. So another question (which I didn’t make very clear in the topic) is how to add the contents of this string to another string that already has content.. I had already seen a code about it, but forgot how and where
– Leonardo
This is the way I used it in the code. You’ll concatenate whatever you want with the
+
, when you don’t want to lose existing content, you just use the variable itself that you want to preserve the content as part of the new result, as I used in the code above. Not to lose the content oftexto
, I used this variable in the concatenation, thus the new value oftexto
will include what you already had intexto
before.– Maniero
Our kk gave a shave here, is that it is so much (study C, Javascript and Shell also) hence a confusion sometimes.. Thanks there
– Leonardo