---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
---
E401 [*] Multiple imports on one line
 --> E40.py:2:1
  |
1 | #: E401
2 | import os, sys
  | ^^^^^^^^^^^^^^
3 |
4 | #: Okay
  |
help: Split imports
  |
1 | #: E401
  - import os, sys
2 + import os
3 + import sys
4 |
  |

E401 [*] Multiple imports on one line
  --> E40.py:65:1
   |
64 | #: E401
65 | import re as regex, string  # also with a comment!
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
66 | import re as regex, string; x = 1
   |
help: Split imports
   |
64 | #: E401
   - import re as regex, string  # also with a comment!
65 + import re as regex
66 + import string  # also with a comment!
67 | import re as regex, string; x = 1
   |

E401 [*] Multiple imports on one line
  --> E40.py:66:1
   |
64 | #: E401
65 | import re as regex, string  # also with a comment!
66 | import re as regex, string; x = 1
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
67 |
68 | x = 1; import re as regex, string
   |
help: Split imports
   |
65 | import re as regex, string  # also with a comment!
   - import re as regex, string; x = 1
66 + import re as regex; import string; x = 1
67 |
   |

E401 [*] Multiple imports on one line
  --> E40.py:68:8
   |
66 | import re as regex, string; x = 1
67 |
68 | x = 1; import re as regex, string
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Split imports
   |
67 |
   - x = 1; import re as regex, string
68 + x = 1; import re as regex; import string
69 |
   |

E401 [*] Multiple imports on one line
  --> E40.py:72:5
   |
71 | def blah():
72 |     import datetime as dt, copy
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
73 |
74 |     def nested_and_tested():
   |
help: Split imports
   |
71 | def blah():
   -     import datetime as dt, copy
72 +     import datetime as dt
73 +     import copy
74 |
   |

E401 [*] Multiple imports on one line
  --> E40.py:75:9
   |
74 |     def nested_and_tested():
75 |         import builtins, textwrap as tw
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
76 |
77 |         x = 1; import re as regex, string
   |
help: Split imports
   |
74 |     def nested_and_tested():
   -         import builtins, textwrap as tw
75 +         import builtins
76 +         import textwrap as tw
77 |
   |

E401 [*] Multiple imports on one line
  --> E40.py:77:16
   |
75 |         import builtins, textwrap as tw
76 |
77 |         x = 1; import re as regex, string
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
78 |         import re as regex, string; x = 1
   |
help: Split imports
   |
76 |
   -         x = 1; import re as regex, string
77 +         x = 1; import re as regex; import string
78 |         import re as regex, string; x = 1
   |

E401 [*] Multiple imports on one line
  --> E40.py:78:9
   |
77 |         x = 1; import re as regex, string
78 |         import re as regex, string; x = 1
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
79 |
80 |     if True: import re as regex, string
   |
help: Split imports
   |
77 |         x = 1; import re as regex, string
   -         import re as regex, string; x = 1
78 +         import re as regex; import string; x = 1
79 |
   |

E401 [*] Multiple imports on one line
  --> E40.py:80:14
   |
78 |         import re as regex, string; x = 1
79 |
80 |     if True: import re as regex, string
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Split imports
   |
79 |
   -     if True: import re as regex, string
80 +     if True: import re as regex; import string
   |
