is_python: Check if a Character String Contains Valid Python Code

View source: R/is_python.R

is_pythonR Documentation

Check if a Character String Contains Valid Python Code

Description

This function takes a character string as input and checks if it contains valid Python code. It returns TRUE if the string contains valid Python code, and FALSE otherwise.

Usage

is_python(code)

Arguments

code

A character string containing code to be checked for Python code validity.

Details

This function presuposes that python is installed on the system.

Value

A logical value: TRUE if the input character string contains valid Python code, and FALSE otherwise.

Examples

## Not run: 
# Check if the string contains valid Python code
is_python("print('Hello, World!')")

# Check if the string contains invalid Python code
is_python("prit('Hello, World!')")

## End(Not run)

TheOpenAIR documentation built on April 27, 2023, 5:10 p.m.