-1

I am trying to concatenate two strings, the problem i'm running into is that when I concatenate, the text goes to the next line. I am using selenium import webdriver. My code is:

randomNum = ""
tries = 0

while (tries < 5):
    randomNum += str(random.randint(0, 9))
    tries = tries + 1

input = driver.find_element_by_id('identifierId')
email = name + randomNum
input.send_keys(email)
print email

I have also tried

randomNum = []
tries = 0

while (tries < 5):
    randomNum.append(random.randint(0, 9))
    tries = tries + 1

input = driver.find_element_by_id('identifierId')
email = name + "".join(str(num) for num in randomNum)
input.send_keys(email)
print email

But when I print email my output is something like

Indoana 16029

I don't know why this is, I need it to be Indoana16029

Cory Sparks
  • 235
  • 1
  • 2
  • 13

1 Answers1

2

your name variable might be contaminated with a new line

have you tried something like this: How can I remove (chomp) a newline in Python?

swisswiss
  • 335
  • 3
  • 13