Remember a strange Python string loss event after splicing multiple variables

Source: Internet
Author: User
Tags python script

There is a loss of value after stitching multiple variables in a single script run.

A = "Hello"

b = "Ketty"

c = A + B + "!"

Expected output is Hello ketty!

The actual output is!

How the script works: Python runtime plus a filename A as a parameter, the Python script runtime reads the data inside a file for parsing, the content of the a file is copied from the local Windows editor after processing the past.

Issue: When the script parses the data for a file, it will be spliced with an item at the end of each line as parameter B and other parameters. When the output string is missing, all the strings that contain the character B are lost,

The reason is that there is a problem with the Windows editor copying past data.

Workaround: Use Dos2unix A on the Linux machine, first convert the format of a file

Remember a strange Python string loss event after splicing multiple variables

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.