Actually that example is not even valid Python code, you'll get an 'n not defined'.
It's certainly valid code. It's an algorithm for finding all prime numbers up to n. If you don't supply n it will not work. There's no way around that in any language whatsoever in any way.
Furthermore you need to indent it properly
If you need to indent it properly it's really, really not a oneliner.
And VB6 you can actually do this on one line
Sub Eratost() : Dim sieve() As Boolean : Dim n As Integer, i As Integer, j As Integer: n = InputBox("limit:", n) : ReDim sieve(n) : For i = 1 To n : sieve(i) = True : Next i : For i = 2 To n : If sieve(i) Then : For j = i * 2 To n Step i : sieve(j) = False : Next j : End If : Next i : For i = 2 To n : If sieve(i) Then Debug.Print i : Next i : End Sub 'Eratost
By this logic, s/\n/; would make any VB6-script into a one-liner. You're really supposed to use one statement, or atleast find something that fits on one line. That code is just a complete algorithm without lineshifts. A one-liner it is not.