Yes you can. The 401k is exempt prior to bankruptcy and the money you remove from it after filing is not subject to the list of assets a trustee would seize, particularly if you are using it for living necessities.
Yes you can, BUT DON'T DO IT! I would rather abandon my furniture and hitchhike out than raid my 401k.
Think about it. When you are short of cash at the end of the month, do you think about going out and robbing an old lady? I doubt it. So why would you rob yourself in your own old age?
This is a bad idea. Find another way. Good luck.
If you find my answer helpful, please click the ‘thumbs-up’ tab below. Thank you.
Disclaimer: Please note that this answer does not constitute legal advice, and should not be relied on, since each state has different laws, each situation is fact specific, and it is impossible to evaluate a legal problem without a comprehensive consultation and review of all the facts and documents at issue. This answer does not create an attorney-client relationship.