parsing_data/quickref.tex
changeset 331 e3136f576acb
parent 238 c507e9c413c6
equal deleted inserted replaced
330:efb8ddf26aff 331:e3136f576acb
     1 Creating a tuple:\\
     1 Splitting a string on whitespace:\\
     2 {\ex \lstinline|    t = (1, "hello", 2.5)|}
     2 {\ex \lstinline|    str_var.split()|}
     3 
     3 
     4 Accessing elements of tuples:\\
     4 Splitting a string using a delimiter. Ex: ";" :\\
     5 {\ex \lstinline|    t[index] Ex: t[2]|}
     5 {\ex \lstinline|    str_var.split(";")|}
     6 
     6 
     7 Accessing slices of tuples:\\
     7 Stripping the whitespace around a string:\\
     8 {\ex \lstinline|    t[start:stop:step]|}
     8 {\ex \lstinline|    str_var.strip()|}
     9 
     9 
    10 Swapping values:\\
    10 Converting a string or float to int:\\
    11 {\ex \lstinline|    a, b = b, a|}
    11 {\ex \lstinline|    int(var_name)|}
       
    12 
       
    13 Converting a string or int into float:\\
       
    14 {\ex \lstinline|    float(var_name)|}
       
    15