John Marston John Marston - 1 year ago 103
Python Question

Checking whether a string starts with XXXX

I would like to know how to check whether a string starts with "hello" in Python.

In Bash I usually do:

if [[ "$string" =~ ^hello ]]; then
do something here

How do I achieve the same in Python?

Answer Source
aString = "hello world"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download