Gabriel Saul
Gabriel Saul

Reputation: 65

String "????" converts to "data" in Python

While writing a small Python script, I noticed that when the string "????" is passed as a command-line argument, it converts to "data" during program execution. Now, I am unsure whether this is a string or some other kind of data type. Finding information on this has been tricky, given the search terms.

Why does this happen and what does it mean?

Upvotes: 0

Views: 43

Answers (1)

Barmar
Barmar

Reputation: 781310

? is a shell wildcard character, it matches any character (similar to . in a regular expression). So an unquoted ???? expands to all filenames with 4 characters. data is presumably the first such filename alphabetically in your directory.

See the output of

echo ????

If you want to pass ???? literally to the script, quote it.

python yourscript.py '????'

Upvotes: 6

Related Questions