Hello all,

I'm beginning in Python and I need to input some information in a declared variable, like this:

XML = """<?xml version="1.0" encoding="utf-8"?>
    <soap12:Envelope 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
         <soap12:Header>
            <Authentication xmlns="http://xxx">
                <Account>xxx</Account>
                <Password>xxx</Password>
                <Guid>xxx</Guid>
            </Authentication>
         </soap12:Header>
         <soap12:Body>
            <SendMessage xmlns="http://xxx">
                <message>
                    <From>xxx</From>
                    <MessageBody>xxx</MessageBody>
                    <MessageDate>xxx</MessageDate>
                    <Subject>xxx</Subject>
                    <Devices>
                        <DeviceMessageVO>
			<Phone>[B]I need to input text here[/B]</Phone>
                        <Country>xxx</Country>
                        <UserDeviceName>xxx</UserDeviceName>
                        </DeviceMessageVO>
                    </Devices>
                </message>
            </SendMessage>
         </soap12:Body>
    </soap12:Envelope>
      """

I search how to make this, I found anything related to raw_input(), but nothing useful is this case.

Thanks!

Function raw_input() would force the user to type in the entire XML code. I don't think you want this.

Normally the XML code would come from file, something like this:

fin = open("Myxml.xml", "r")
xml_string = fin.read()
fin.close()

# now the xml code is represented by xml_string for you to work on.

Solved! I'm using sys.argv[] for this issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.