Print Document

Python Code Reference
Version 01
Release Date 01 Jan 2021
Type SAP Documents
Status Released

Python RegEx module

Replace multiple instance of a sub string using Re module

import re

txt = "The rain in Spain"
x = re.search("^The.*Spain$", txt)

 

Python : Create long multiline string

Use """ (3 quotes) for string extending to multiple lines.  

 

LongString = """ This is a long string and will span across
                 multiple lines. 
                 This is a very good tool for readability."""

 

Generate Random Number

Return a random number between 1 and 10:

Math.floor((Math.random() * 10) + 1);


Return a random number between 1 and 100:
Math.floor((Math.random() * 100) + 1);

 


Table of contents

Technical Documents
Configuration Guide
External Reference
Python re module
SAP Note
SDN Links
Messages
Sample Code