Tag

ast.literal_eval

0 views collected around this technical thread.

Test Development Learning Exchange
Test Development Learning Exchange
Oct 1, 2024 · Fundamentals

Python Data Type Conversions: str ↔ list ↔ JSON and Common Transformations

This article explains how to convert between strings, lists, dictionaries, and JSON in Python using ast.literal_eval, json.loads, and json.dumps, and demonstrates practical applications such as API response handling in automation testing.

Data ConversionJSON__str__
0 likes · 6 min read
Python Data Type Conversions: str ↔ list ↔ JSON and Common Transformations
Test Development Learning Exchange
Test Development Learning Exchange
Jun 19, 2024 · Fundamentals

Safe Parsing of Strings in Python with ast.literal_eval

This article explains how to securely convert external string data into Python literals using the ast.literal_eval function, covering its principles, advantages, basic and advanced usage examples, special scenarios, error handling, and security best practices.

Code SecurityData HandlingPython
0 likes · 5 min read
Safe Parsing of Strings in Python with ast.literal_eval
Test Development Learning Exchange
Test Development Learning Exchange
Jun 17, 2024 · Backend Development

How to Unquote Strings in Python: eval, ast.literal_eval, and json.loads

This article explains three common methods—eval, ast.literal_eval, and json.loads—for converting quoted Python strings into executable code or data structures, outlining their advantages, disadvantages, and appropriate use cases.

Data Serializationast.literal_evaleval
0 likes · 5 min read
How to Unquote Strings in Python: eval, ast.literal_eval, and json.loads
Test Development Learning Exchange
Test Development Learning Exchange
Jun 17, 2024 · Fundamentals

Understanding Python's eval(): Usage, Risks, and Safer Alternatives

This article explains Python's eval() function, demonstrates basic and variable usage, highlights security risks, and presents safer alternatives such as ast.literal_eval and restricted eval implementations, providing code examples and practical recommendations for secure code execution.

Pythonast.literal_evalcode execution
0 likes · 5 min read
Understanding Python's eval(): Usage, Risks, and Safer Alternatives