Website hosting service by Active-Venture.com
  

 Back to Index


5.20.3 Parsing Rules

When operating in non-POSIX mode, shlex will try to obey to the following rules.

 

  • Quote characters are not recognized within words (Do"Not"Separate is parsed as the single word Do"Not"Separate);
  • Escape characters are not recognized;
  • Enclosing characters in quotes preserve the literal value of all characters within the quotes;
  • Closing quotes separate words ("Do"Separate is parsed as "Do" and Separate);
  • If whitespace_split is False, any character not declared to be a word character, whitespace, or a quote will be returned as a single-character token. If it is True, shlex will only split words in whitespaces;
  • EOF is signaled with an empty string ('');
  • It's not possible to parse empty strings, even if quoted.

When operating in POSIX mode, shlex will try to obey to the following parsing rules.

 

  • Quotes are stripped out, and do not separate words ("Do"Not"Separate" is parsed as the single word DoNotSeparate);
  • Non-quoted escape characters (e.g. "\") preserve the literal value of the next character that follows;
  • Enclosing characters in quotes which are not part of escapedquotes (e.g. "'") preserve the literal value of all characters within the quotes;
  • Enclosing characters in quotes which are part of escapedquotes (e.g. """) preserves the literal value of all characters within the quotes, with the exception of the characters mentioned in escape. The escape characters retain its special meaning only when followed by the quote in use, or the escape character itself. Otherwise the escape character will be considered a normal character.
  • EOF is signaled with a None value;
  • Quoted empty strings ('') are allowed;

 

    

 

2002-2004 Active-Venture.com Webhosting Service

 

Disclaimer: This documentation is provided only for the benefits of our hosting customers.
For authoritative source of the documentation, please refer to http://python.org/doc/

 

Active-Domain.com offers domain name registration, domain name transfer and domain search services  

Cheap domain registration : Register domain name or buy domain name, including free domain hosting services

 
 

Domain registration : Buy domain name or register domain name from $5.95/year only