У меня есть скрипт, который принимает sys.argv, и ввод может содержать специальные символы (точка с запятой). Мне просто нужен ввод в виде строки, но точка с запятой все портит ..
У меня есть:
def myscript(text)
print text
a = myscript(sys.argv[1])
print a
Я пытаюсь:
>> python script.py "With these words she greeted Prince Vasili Kuragin, a man of high rank and importance, who was the first to arrive at her reception. Anna Pavlovna had had a cough for some days. She was, as she said, suffering" from la grippe; grippe being then a new word in St. Petersburg""
Я получаю:
'With these words she greeted Prince Vasili Kuragin, a man of high rank and importance, who was the first to arrive at her reception. Anna Pavlovna had had a cough for some days. She was, as she said, suffering'
None
bash: grippe: command not found
Я просто хочу вставить всю строку в скрипт независимо от того, что внутри него ..
Я пытался:
a = myscript(repr(sys.argv[1]))
a = myscript(str(sys.argv[1]))